﻿using IDAL;
using Model;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DAL
{
    public class FrExamManage_DAL : IFrExamManage_IDAL
    {
        List<ExamInfo_MD> IFrExamManage_IDAL.ExamInfo_s(string path)
        {

            SqlDataReader reader = SQLHepler.GetDataReader($"select *from view_2 {path}");
            List<ExamInfo_MD> exams = new List<ExamInfo_MD>();
            while (reader.Read())
            {
                exams.Add(new ExamInfo_MD()
                {
                    PapersNumber = reader["PapersNumber"].ToString(),
                    PapersName = reader["PapersName"].ToString(),
                    TestStartTime = reader["TestStartTime"].ToString(),
                    TestDuration = reader["TestDuration"].ToString(),
                    ExamCourse = reader["CourseName"].ToString(),
                    ExaminationVenues = reader["ClassName"].ToString()
                });
            }
            reader.Close();
            return exams;
        }
    }
}
